package cn.edu.scau.cmi.dengzejun.chapter11;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class WindowActionEventForSix extends JFrame{
	JTextField inputText;
	JTextArea textShow;
	JButton button;
	PoliceListen listener;
	public WindowActionEventForSix() {
		this.init();
		this.setVisible(true);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		return;
	}
	
	private void init() {
		this.setLayout(new FlowLayout());
		this.inputText = new JTextField(10);
		this.button = new JButton("Read");
		this.textShow = new JTextArea(5,18);
		this.listener = new PoliceListen();
		this.listener.setJTextField(this.inputText);
//		this.listener.setJTextArea(this.textShow);
		this.inputText.addActionListener(this.listener);
		this.button.addActionListener(this.listener);
		this.add(this.inputText);
		this.add(this.button);
		this.add(new JScrollPane(this.textShow));
		return;
	}
}
